import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/router'
import store from './store/'
import {routerMode} from './config/env'
import './config/rem'
import FastClick from 'fastclick'
import { 
	Button, 
	Icon,
	Swipe,
	SwipeItem,
	NavBar,
	List,
	Dialog,
	Field,
	Cell,
	CellGroup,
	Notify,
	Row, 
	Col, 
	Rate,
	Tab, 
	Tabs, 
	Popup, 
	Tabbar, 
	TabbarItem, 
	Uploader,
	Panel,
	SubmitBar,
	PullRefresh,
	Search,
	Actionsheet,
	Stepper 
} from 'vant'
if ('addEventListener' in document) {
    document.addEventListener('DOMContentLoaded', function() {
        FastClick.attach(document.body);
    }, false);
}
/**配置vant组件,常用多个地方用到的全局引入、不常用的可以在局部引入 */
Vue.use(VueRouter).
use(Row).
use(Col).
use(Button).
use(Icon).
use(Swipe).
use(SwipeItem).
use(NavBar).
use(List).
use(Dialog).
use(Field).
use(Cell).
use(CellGroup).
use(Notify).
use(Rate).
use(Tab).
use(Tabs).
use(Popup).
use(Tabs).
use(Tabbar).
use(TabbarItem).
use(Uploader).
use(Panel).
use(SubmitBar).
use(PullRefresh).
use(Search).
use(Actionsheet).
use(Stepper)
const router = new VueRouter({
	routes,
	mode: routerMode,
	strict: process.env.NODE_ENV !== 'production',
	scrollBehavior (to, from, savedPosition) {
	    if (savedPosition) {
		    return savedPosition
		} else {
			if (from.meta.keepAlive) {
				from.meta.savedPosition = document.body.scrollTop;
			}
		    return { x: 0, y: to.meta.savedPosition || 0 }
		}
	}
})

new Vue({
	router,
	store,
}).$mount('#app')

